package org.codeasy.ceutils.set;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;

import org.codeasy.ceutils.string.StringUtil;

public class MapUtil {
	
	public static String joinMap2Str(Map<String, String> map, String joinBy) {
		if (map == null || map.size() <= 0) {
			return "";
		}
		if (StringUtil.isBlank(joinBy)) {
			joinBy = ",";
		}
	    Set<Map.Entry<String, String>> set = map.entrySet();
	    Iterator<Map.Entry<String, String>> it = set.iterator(); 
	   
	    StringBuffer sb = new StringBuffer();
	    
	    while(it.hasNext()) {
	    	Map.Entry<String, String> entry = it.next();
	    	sb.append(entry.getValue().toString());
	    	sb.append(joinBy);
	    }
	    return StringUtil.removeLastStr(sb.toString(), joinBy.length());
	}
	
	public static void main(String[] args) {
	}
}
